﻿Imports QuanLyLuong.Entity
Imports QuanLyLuong.DL

Public Class BLDictionary
    Inherits BL.BLBase

#Region "Declaration"
    Private m_strForeignKey As String
    Private Const mscSQLExceptionContrainsNumber As Integer = 547
    Private Const mscSQLExceptionConcurrence As String = "Row ban xoa khong ton tai"
    Private oDLDictionary As DLDictionary
#End Region

#Region "Property"

    Public Property ForeignKey() As String
        Get
            Return m_strForeignKey
        End Get
        Set(ByVal value As String)
            m_strForeignKey = value
        End Set
    End Property
#End Region

#Region "Constructor"

#End Region

#Region "Get Method"

#End Region

#Region "CRUD"

    Public Sub GetUnitConvertByItemID(ByRef table As DataTable, ByVal sItemID As String)
        Try
            table.Clear()
            oDLDictionary.GetUnitConvertByItemID(table, sItemID)
        Catch ex As Exception
            Throw
        End Try
    End Sub

    Public Function GetUnitConvertByItemID(ByVal sItemID As String) As DataTable
        Try
            Return oDLDictionary.GetUnitConvertByItemID(sItemID)
        Catch ex As Exception
            Throw
        End Try
    End Function

#Region "InitNewRow"

    'Public Function AddNewInward(Optional ByVal strID As Object = Nothing) As DataRow
    '    Dim dr As DataSetDictionary.InwardRow = Nothing
    '    dr = dtBusiness.NewRow
    '    With dr
    '        .RefID = IIf(strID IsNot Nothing, strID, Guid.NewGuid.ToString)
    '        .RefDate = Now.Date
    '    End With
    '    dtBusiness.Rows.InsertAt(dr, 0)
    '    Return dr
    ''End Function

    'Public Function AddNewOutward(Optional ByVal strID As Object = Nothing) As DataRow
    '    Dim dr As DataSetDictionary.OutwardRow = Nothing
    '    dr = dtBusiness.NewRow
    '    With dr
    '        .RefID = IIf(strID IsNot Nothing, strID, Guid.NewGuid.ToString)
    '        .RefDate = Now.Date
    '    End With
    '    dtBusiness.Rows.InsertAt(dr, 0)
    '    Return dr
    'End Function

     'Public Function AddNewAccountingObjectCategory(Optional ByVal strID As Object = Nothing) As DataRow
    '    Dim dr As DataSetDictionary.AccountingObjectCategoryRow = Nothing
    '    dr = dtBusiness.NewRow
    '    With dr
    '        .AccountingObjectCategoryID = IIf(strID IsNot Nothing, strID, Guid.NewGuid.ToString)
    '        '.AccountingObjectCategoryCode = ""
    '        .AccountingObjectCategoryName = ""
    '    End With
    '    dtBusiness.Rows.InsertAt(dr, 0)
    '    Return dr
    'End Function

    'Public Function AddNewAccountingObject(Optional ByVal strID As Object = Nothing) As DataRow
    '    Dim dr As DataSetDictionary.AccountingObjectRow = Nothing
    '    dr = dtBusiness.NewRow
    '    With dr
    '        .AccountingObjectID = IIf(strID IsNot Nothing, strID, Guid.NewGuid.ToString)
    '        .AccountingObjectCode = ""
    '        .AccountingObjectName = ""
    '        .AccountingObjectType = Entity.AccountingObjectType.Both
    '        .IsEmployee = False
    '    End With
    '    dtBusiness.Rows.InsertAt(dr, 0)
    '    Return dr
    'End Function

    'Public Function AddNewEmployee(Optional ByVal strID As Object = Nothing) As DataRow
    '    Dim dr As DataSetDictionary.AccountingObjectRow = Nothing
    '    dr = dtBusiness.NewRow
    '    With dr
    '        .AccountingObjectID = IIf(strID IsNot Nothing, strID, Guid.NewGuid.ToString)
    '        .AccountingObjectCode = ""
    '        .AccountingObjectName = ""
    '        .AccountingObjectType = Entity.AccountingObjectType.None
    '        .IsEmployee = True
    '    End With
    '    dtBusiness.Rows.InsertAt(dr, 0)
    '    Return dr
    'End Function

    'Public Function AddNewItem(Optional ByVal strID As Object = Nothing) As DataRow
    '    Dim dr As DataSetDictionary.ItemRow = Nothing
    '    dr = dtBusiness.NewRow
    '    With dr
    '        .ItemID = IIf(strID IsNot Nothing, strID, Guid.NewGuid.ToString)
    '        .ItemCode = ""
    '        '.Barcode = ""
    '        '.ItemName = ""
    '        '.DiscountRate = 0
    '        '.SalePrice = 0
    '        '.PurchasePrice = 0
    '        '.LimitQuantity = 0
    '        '.Inactive = False
    '    End With
    '    dtBusiness.Rows.InsertAt(dr, 0)
    '    Return dr
    'End Function

#End Region

#End Region

#Region "Private Method"

#End Region

#Region "Other Method"

    Public Overrides Sub InitPublicObject()
        oDLBase = New DLDictionary(BLCommonFactory.DatabaseConnectName)
        oDLDictionary = oDLBase
    End Sub

    Public Function CheckDictionaryHasArisen(ByVal DictionaryTableName As String, ByVal DictionaryCodeColumnName As String, ByVal DictionaryIDList As String, ByVal DictionaryName As String) As String
        Return False
    End Function

#End Region
End Class
